package me.khrystal.cleanmaster.base;

import android.app.Application;
import android.content.Context;
import android.os.Process;

/**
 * usage:
 * author: kHRYSTAL
 * create time: 16/9/14
 * update time:
 * email: 723526676@qq.com
 */
public class BaseApplication extends Application {

    private static BaseApplication mInstance;

    private Context mContext;

    public static BaseApplication getInstance() {
        return mInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(getApplicationContext());
        Thread.currentThread().setUncaughtExceptionHandler(crashHandler);
    }

    @Override
    public void onLowMemory() {
        // TODO: 16/9/14
        android.os.Process.killProcess(android.os.Process.myPid());
        super.onLowMemory();
    }
}
